# non-standard products, it needs the set names
chart <- makeChart("a, b, ~c", "abc, a~b~c, a~bc, ~ab~c")
# same with unquoted expressions
chart <- makeChart(c(a, b, ~c), c(abc, a~b~c, a~bc, ~ab~c))
chart
# abc a~b~c a~bc ~ab~c
# a x x x -
# b x - - x
# ~c - x - x
findmin(chart)
# 2
solveChart(chart)
# first and second rows (a + b)
# and first and third rows (a + ~c)
# a is an essential prime implicant
# a + b a + ~c
# [,1] [,2]
# [1,] 1 1
# [2,] 2 3
# using SOP standard product sign
rows <- "EF, ~GH, IJ"
cols <- "~EF*~GH*IJ, EF*GH*~IJ, ~EF*GH*IJ, EF*~GH*~IJ"
chart <- makeChart(rows, cols)
chart
# ~EF*~GH*IJ EF*GH*~IJ ~EF*GH*IJ EF*~GH*~IJ
# EF - x - x
# ~GH x - - x
# IJ x - x -
solveChart(chart)
# ~GH is redundant
# EF + IJ
# [,1]
# [1,] 1
# [2,] 3
# using implicant matrices
primes <- matrix(c(2,2,1,0,2,2,0,2,2,2), nrow = 2)
configs <- matrix(c(2,2,2,1,1,2,2,2,2,1,2,2,2,2,2), nrow = 3)
colnames(primes) <- colnames(configs) <- letters[1:5]
# the prime implicants: a~bce and acde
primes
# a b c d e
# [1,] 2 1 2 0 2
# [2,] 2 0 2 2 2
# the initial causal combinations: a~bc~de, a~bcde and abcde
configs
# a b c d e
# [1,] 2 1 2 1 2
# [2,] 2 1 2 2 2
# [3,] 2 2 2 2 2
chartLC <- makeChart(primes, configs, collapse = "")
chartLC
# a~bc~de a~bcde abcde
# a~bce x x -
# acde - x x
Run the code above in your browser using DataLab